/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.ajz.service;


import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.ajz.dao.AjzRecordProcessDao;
import com.jeesite.modules.ajz.entity.AjzCompanyInfo;
import com.jeesite.modules.ajz.entity.AjzRecord;
import com.jeesite.modules.ajz.entity.AjzRecordProcess;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 历史记录Service
 * @author cww
 * @version 2019-01-11
 */
@Service
@Transactional(readOnly=true)
public class AjzRecordProcessService extends CrudService<AjzRecordProcessDao, AjzRecordProcess> {

	
	/**
	 * 获取单条数据
	 * @param ajzRecordProcess
	 * @return
	 */
	@Override
	public AjzRecordProcess get(AjzRecordProcess ajzRecordProcess) {
		return super.get(ajzRecordProcess);
	}
	
	/**
	 * 查询分页数据
	 * @param ajzRecordProcess 查询条件
	 * @param ajzRecordProcess.page 分页对象
	 * @return
	 */
	@Override
	public Page<AjzRecordProcess> findPage(AjzRecordProcess ajzRecordProcess) {
		return super.findPage(ajzRecordProcess);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param ajzRecordProcess
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(AjzRecordProcess ajzRecordProcess) {
		super.save(ajzRecordProcess);
	}
	
	/**
	 * 更新状态
	 * @param ajzRecordProcess
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(AjzRecordProcess ajzRecordProcess) {
		super.updateStatus(ajzRecordProcess);
	}
	
	/**
	 * 删除数据
	 * @param ajzRecordProcess
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(AjzRecordProcess ajzRecordProcess) {
		super.delete(ajzRecordProcess);
	}


	@Transactional(readOnly=false)
	public void saveRecord(AjzRecord ajzRecord) {
		dao.saveRecord(ajzRecord);
	}

	public List findListByTime(String start,String end) {
		return dao.findListByTime(start,end);
	}

    public List<AjzRecordProcess> findListByInfoId(AjzRecord record) { return dao.findListByInfoId(record);
    }

/**
	 * 为了方便查找上一次的检查记录
	 * 通过record与recordProcess表里的number字段区分不同时段的检查记录
	 * @param number
	 */
	public AjzRecordProcess findForNum(String number){
		return dao.findForNum(number);
	}

	public AjzRecordProcess findById(String id){
		return  dao.findById(id);
	}

}